<?php defined('SYSPATH') or die('No direct script access.');

// extends purifier_security couse purifier extends kohana security and i don't want to overwrite pirifier 
class Security extends Purifier_Security {
    
     /**
      * Generates token of given length using mt_rand.
      * @param int $length
      * @return string
      */
    
    public static function generate_token($lenght = 32) 
    { 
            $token = '';
            // define possible characters (does not include l, number relatively likely)
            $possible = '123456789abcdefghjkmnpqrstuvwxyz';
            $i = 0;
           
            while ($i < $lenght) 
            {
                // pick a random character from the possible ones
                $char = substr($possible, mt_rand(0, strlen($possible)-1), 1);
                $token .= $char;
                $i++;
            }
            
            return $token;  
    }
}